/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package solitaireofdoom.solitaire;

import javax.swing.Timer;
import java.awt.event.*;

/**
 * The SolitaireType class is an abstract class inherited by the various types of games such as the Klondike class. It has the basic variables and functions needed for loading games, saving games, starting new games, checking if a game has finished, keeping track of the elapsed time during a game, etc.
 *
 * @author Administrator
 */
public class SolitaireType extends javax.swing.JComponent
{
    protected int plausibleMoves;
    protected Timer gameTimer;
    
    public final String name = "Generic Solitaire";
    public int gameTimeSeconds = 0;

    public SolitaireType()
    {
        SolitaireGameTimerActionListener sgtal = new SolitaireGameTimerActionListener();

        gameTimer = new Timer(1000, sgtal);
    }

    /**
     * Starts a new freecell game
     */
    public void newGame()
    {
        this.gameTimeSeconds = 0;
        this.gameTimer.start();
    }

    /**
     * Save the current game.
     */
    public void saveGame() {}

    /**
     * Load a saved game
     */
    public void loadGame() {}

    /**
     * Reports that a pile was changed
     */
    public void pileChanged() {}

    /**
     * Check if the game has finished
     */
    public void checkFinished() {}

    /**
     * Reports that a pile was changed
     */
    public void checkPlausibleMoves() {}

    /**
     * Shows a plausible move to the user
     */
    public void showHint() {}

    public class SolitaireGameTimerActionListener implements ActionListener
    {
        public void actionPerformed(ActionEvent evt)
        {
            SolitaireType.this.gameTimeSeconds++;
        }
    }
}
